package com.lancoo.znbkxx.utils;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

/**
 * Create by TangJun on 2019/2/16
 */
public class Util {
    public static  String getCurrentDateString() {
        return getCurrentDateString("yyyyMMdd HH:mm:ss");
    }

    public static String getCurrentDateString(String form) {
        return getTimeByDate(getCurrentDate(), form);
    }

    public static String getTimeByDate(Date date, String form) {
        SimpleDateFormat simpleFormatter = new SimpleDateFormat(form);
        return simpleFormatter.format(date);
    }

    public static Date getCurrentDate() {
        Calendar calendar = Calendar.getInstance();
        return calendar.getTime();
    }
}
